<?php
/**
 * Created by PhpStorm.
 * User: 小蛮哼哼哼
 * Email: 243194993@qq.com
 * Date: 2022/4/19
 * Time: 14:41
 * motto: 现在的努力是为了小时候吹过的牛逼！
 */

namespace app\api\controller\v1;

use app\common\lib\Show;
use app\common\lib\Status;
use app\common\model\MallGoods;

class Goods extends Base
{
    public function goodsIndexList(){
        if(!$this->request->isPost()){
            return Show::json_show(Status::mini_error,"请求类型异常");
        }
        $cate_ids = $this->request->param('cate_ids',[]);
        if(empty($cate_ids)){
            return Show::json_show(Status::mini_error,"分类异常");
        }
        $num = $this->request->param('num',10,'intval');
        //查询分类
        try {
            $lists = (new MallGoods())->goodsIndexList($cate_ids, $num,'id,price,title,thumb_title,logo');
        } catch (\Exception $exception) {
            return Show::json_show(Status::mini_error,"查询失败");
        }
        return Show::json_show(Status::mini_normal,'ok',$lists);
    }
}